<?php
$dbHost = '127.0.0.1';
$dbUsername = 'root';
$dbPwd = 'root';
$dbName = 'jxc';
$engine = 'InnoDB';
$rowFormat = 'dynamic';
$mysqli = new \mysqli($dbHost, $dbUsername, $dbPwd, $dbName);
if ($mysqli->connect_errno) {
    echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
}
echo $mysqli->host_info . "\n";

$show = $mysqli->query("show table status from $dbName where Engine <> '$engine'");
if ($show) {
    var_dump($mysqli->error);
}

echo "Result set order...\n";
$show->data_seek(0);
$name = [];
while ($row = $show->fetch_assoc()) {
    $name[] = $row['Name'];
}
var_dump($name);
$res = [];
foreach ($name as $value) {
    $r[0] = $mysqli->query(' alter table '. $value. " row_format = $rowFormat");
    $r[1] = $mysqli->query(' alter table '. $value. " ENGINE = $engine");
    // 错误则返回报错信息
    if ($r) {
        $res[] = $r;
    } else {
        $res[] = $mysqli->error;
    }
}
var_dump($res);

